Skip to content

fix: prevent initial right-click from selecting a context menu item#3877

Open
Fazalkadivar21 wants to merge 1 commit into
pingdotgg:mainfrom
Fazalkadivar21:linux-sidebar-menu-fix
Open

fix: prevent initial right-click from selecting a context menu item#3877
Fazalkadivar21 wants to merge 1 commit into
pingdotgg:mainfrom
Fazalkadivar21:linux-sidebar-menu-fix

Conversation

@Fazalkadivar21

@Fazalkadivar21 Fazalkadivar21 commented Jul 11, 2026

Copy link
Copy Markdown

What Changed

  • Prevent the pointer event that opens a context menu from immediately selecting one of its items.
  • Ensure pointer-based selection is only enabled after the opening interaction has completed.
  • Add test coverage for delayed pointer selection to prevent this behavior from regressing.

Why

On Linux, right-clicking a project or thread in the desktop app could cause the context menu to briefly appear and immediately close while activating a menu item.

The same pointer interaction used to open the menu was also being interpreted as a menu-item selection. This made context menus unreliable and could trigger unintended actions without a second click.

This change keeps pointer selection disabled during the initial opening interaction, while still allowing menu items to be selected normally after the required delay.

Fixes #3698

UI Changes

Before

Right-clicking a project or thread could immediately activate a random context-menu item and close the menu.

Recording:

before.mp4

After

The context menu remains open after the initial right-click and waits for a separate selection from the user.

Recording:

recording_2026-07-11_08.01.50.mp4

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Low Risk
Small, localized change to fallback context-menu pointer handling with targeted test coverage; no auth, data, or API impact.

Overview
Fixes Linux/desktop behavior where the same pointer interaction that opened the fallback context menu could immediately activate a leaf item and close the menu.

Leaf menu buttons now call cleanup only when canDismissFromPointer is true, matching the existing delay (set on the next animation frame) used for outside dismiss. Clicks during the opening gesture are ignored; a separate click still selects normally.

Adds a test that defers the rAF callback so the first click is ignored and the second resolves the item id.

Reviewed by Cursor Bugbot for commit d5fe9e0. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Ignore the opening click gesture in the context menu fallback

A click that occurs before the first animation frame after the menu opens no longer resolves the menu. This is done by gating leaf-item click handling on a canDismissFromPointer flag, which is set to true via requestAnimationFrame after the menu is rendered.

Macroscope summarized d5fe9e0.

- Prevent the initial pointer click from selecting a menu item
- Add coverage for delayed pointer selection
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4504c28e-bd54-434e-93cc-3f31cfb45ae1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Jul 11, 2026
@Fazalkadivar21 Fazalkadivar21 changed the title Ignore opening gesture in context menu fallback fix: prevent initial right-click from selecting a context menu item Jul 11, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Simple bug fix that adds a guard condition to prevent accidental menu item selection from the initial right-click gesture. Uses an existing canDismissFromPointer pattern already in the codebase and includes a test.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Sidebar context menu auto-selects a random item on right-click (regression of #285)

1 participant